#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
int main()
{
	ll m,n;
	ll a[200005];
	ll b[m][2]={0};
	unsigned int x=0;
	cin >> n >> m >> x;
	ll i,j;
	for(i=0;i<n;i++)
	{
		cin >> a[i];
	}	
	for(i=0;i<m;i++)
	{
		for(j=0;j<2;j++)
		{
			cin >> b[i][j];
			
			
    	
		}
			ll a=b[i][j];
			ll c=b[i][j];
			int result=a ^ c;
			if (result==x) {
       			printf("yes\n");
    		} 	else {
        		printf("no\n");
    		}
		
	}
	return 0;
}
